# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-piccata
pkgver=2.0.3
pkgrel=1
pkgdesc="Python CoAP Toolkit"
url="https://github.com/NordicSemiconductor/piccata"
arch="noarch"
license="MIT"
depends="python3"
makedepends="
	py3-gpep517
	py3-installer
	py3-setuptools
	py3-wheel
	"
subpackages="$pkgname-pyc"
source="piccata-$pkgver.tar.gz::https://github.com/NordicSemiconductor/piccata/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/piccata-$pkgver"
options="!check" # no test ran

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# test_decode is broken
	case "$CARCH" in
		ppc64le) .testenv/bin/python3 -m unittest discover -k 'not test_decode and not test_client_server_communication' ;;
		*) .testenv/bin/python3 -m unittest discover -k 'not test_decode' ;;
	esac
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
0ca0a94e8eff860ddf8a2c41c4047e0838543490e12f651859d176bf70fd892618f92bc7da47cc6612bd2885f6a122b6ba9349d3536ce2abfcee1db81caf6624  piccata-2.0.3.tar.gz
"
